{% extends 'users/base.html' %}

{% block content %}
    <main>
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-lg-5">
                    {% if messages or form.non_field_errors %}
                        <div class="alert {% if messages %} alert-success {% else %} alert-warning {% endif %} alert-dismissible fade show"
                             role="alert"
                             style="margin-top: 50px;">
                            {% if messages %}
                                {% for message in messages %}
                                    {{ message }}
                                {% endfor %}
                            {% else %}
                                {{ form.non_field_errors }}
                            {% endif %}
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                    {% endif %}
                    <div class="card shadow-lg border-0 rounded-lg mt-5">
                        <div class="card-header"><h3 class="text-center font-weight-light my-4">Авторизация</h3>
                        </div>
                        <div class="card-body">
                            <form action="{% url 'users:login' %}" method="POST">
                                {% csrf_token %}

                                {% for field in form %}

                                    <div class="form-group">
                                        <label class="small mb-1" for="{{ field.auto_id }}">{{ field.label }}</label>
                                        {{ field }}
                                    </div>


                                {% endfor %}

                                <div class="form-group d-flex align-items-center justify-content-between mt-4 mb-0">
                                    <a class="small" href="#">Забыли пароль?</a>
                                    <input class="btn btn-primary" type="submit" value="Авторизоваться">
                                </div>
                                <div class="form-group d-flex align-items-center justify-content-between mt-4 mb-0">
                                    <a href="#">
                                        <i class="fab fa-google fa-2x" style="color: #d9503e;"></i>
                                    </a>
                                    <a href="#">
                                        <i class="fab fa-vk fa-2x" style="color: #4a658b;"></i>
                                    </a>
                                    <a href="#">
                                        <i class="fab fa-github fa-2x" style="color: #303030;"></i>
                                    </a>
                                    <a href="#">
                                        <i class="fab fa-facebook fa-2x" style="color: #405794;"></i>
                                    </a>
                                </div>
                            </form>
                        </div>
                        <div class="card-footer text-center">
                            <div class="small"><a href="{% url 'users:register' %}">Нужен аккаунт? Зарегистрируйся!</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
{% endblock %}

